@using System.Text.RegularExpressions;
@inject IJSRuntime JSRuntime

<pre style="max-height: 500px; overflow: auto; font-size: 12px" @ref="pre">@source</pre>

@code {
    private ElementReference pre;
    private string source;

    [Parameter]
    public string PageName { get; set; }

    protected override async Task OnInitializedAsync()
    {
        var http = new HttpClient();

        source = await http.GetStringAsync($"https://raw.githubusercontent.com/akorchev/blazor.radzen.com/master/Pages/{PageName}");
        source = Regex.Replace(source, "</?RadzenExample[^>]*>\n", "");
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (!String.IsNullOrEmpty(source))
        {
            await JSRuntime.InvokeAsync<object>("hljs.highlightBlock", pre);
        }
    }
}